const my_channel = new BroadcastChannel('my_channel');

const send_msg = (data)=>{
    my_channel.postMessage(data)
}

const listen_msg = (callback)=>{
    my_channel.addEventListener("message",(e)=>{
        callback && callback(e.data)
    })
}

export {
    send_msg,
    listen_msg
}